import type { App } from 'vue';
const Compontents: { [propName: string]: any } = {};

// 大型组件引入
const Folder = import.meta.glob('./**/index.vue', { eager: true, import: 'default' });
for (const key in Folder) {
    const _key = key.replace(/\/index\.vue/g, '').replace(/\.\//g, 'C_');
    Compontents[_key] = Folder[key]
}

// 小型组件引入
const singleFile = import.meta.glob('./*.vue', { eager: true, import: 'default' });
for (const key in singleFile) {
    const _key = key.replace(/\.vue/g, '').replace(/\.\//g, 'C_');
    Compontents[_key] = singleFile[key]
}

export default {
    install: (app: App) => {
        for (const key in Compontents) {
            const element = Compontents[key];
            app.component(key, element)
        }
    }
}